Skip to content

feat: wrapApprove intent wiring (sendMany type + prebuild + shieldParams passthrough) - #9556

Merged
0xPrabh merged 1 commit into
masterfrom
CHALO-1340
Sep 1, 2026
Merged

feat: wrapApprove intent wiring (sendMany type + prebuild + shieldParams passthrough)#9556
0xPrabh merged 1 commit into
masterfrom
CHALO-1340

Conversation

@0xPrabh

@0xPrabh 0xPrabh commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description

Wires sendMany({ type: 'wrapApprove' | 'wrap', shieldParams }) so a wrap intent can reach wallet-platform.

Wallet.send() remains a single-payment helper (address + amount). Wrap has no client recipient; WP builds the calldata from tokenName and amount. This change:

  • Adds wrapApprove / wrap as TSS prebuildTransaction intent types
  • Passes shieldParams: { tokenName, amount } through BuildParams / populateIntent
  • Flattens those fields onto the WP intent (tokenName, amount)
  • Allows no-recipient wrap in NO_RECIPIENT_TX_TYPES (wrapApprove was already listed)

Issue Number

CHALO-1340

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

npx mocha test/unit/bitgo/utils/mpcUtils.wrapApprove.ts
npx mocha test/unit/bitgo/utils/tss/recipientUtils.ts test/unit/bitgo/wallet/BuildParams.ts

(from modules/sdk-core)

Also added bitgo wallet unit tests for prebuildTransaction / populateIntent. Those require a full monorepo install (missing @bitgo/sdk-coin-pearl in this local tree).

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My commits follow Conventional Commits
  • The ticket was included in the commit message as a reference
  • I have added tests that prove my fix is effective or that my feature works

Made with Cursor

@0xPrabh
0xPrabh requested review from a team as code owners August 25, 2026 07:06
@linear-code

linear-code Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

CHALO-1340

@0xPrabh 0xPrabh changed the title CHALO-1340: [SDK] wrapApprove intent wiring (sendMany type + prebuild + shieldParams passthrough) feat: wrapApprove intent wiring (sendMany type + prebuild + shieldParams passthrough) Aug 25, 2026
@0xPrabh
0xPrabh marked this pull request as draft August 25, 2026 07:19
@0xPrabh

0xPrabh commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@claude

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Claude finished @0xPrabh's task —— View job


Code Review Complete ✅

I've completed a thorough review of the wrapApprove intent wiring implementation. Here's my analysis:

Architecture & Implementation

The implementation correctly wires wrapApprove and wrap intent types through the TSS system:

  1. Type Safety: Added WrapIntentParams interface in baseTypes.ts:302-306 with proper validation
  2. Intent Population: Enhanced mpcUtils.ts:339-357 to flatten wrapParams onto WP intents with proper validation
  3. No-Recipient Support: Correctly added wrap to NO_RECIPIENT_TX_TYPES (line 36) alongside existing wrapApprove
  4. Parameter Passthrough: Added wrapParams to BuildParams.ts:165 and iWallet.ts:300-306

Validation & Security

  • Input validation: Proper checks for required wrapParams, non-empty tokenName, and positive integer amount (lines 341-349)
  • Type guards: EVM + TSS checks ensure correct coin family usage
  • No recipients validation: Correctly bypasses recipient requirements for wrap operations

Test Coverage

Comprehensive test suite covering:

  • Intent population with proper field flattening (mpcUtils.wrapApprove.ts)
  • Parameter validation (required fields, positive amounts)
  • Wallet prebuild integration tests (wallet.ts:3629-3680)
  • No-recipient validation (recipientUtils.ts)

Code Quality

  • Consistency: Follows existing patterns for DeFi intents
  • Documentation: Clear JSDoc comments explaining ERC-7984 usage
  • Error Messages: Descriptive validation error messages
  • Naming: Consistent with existing defiParams pattern

Minor Observations

  1. Regex Pattern: The amount validation regex /^[1-9]\d*$/ correctly excludes zero and negatives
  2. Field Mapping: Proper flattening from nested wrapParams to top-level intent fields
  3. TSS Integration: Correctly integrated with existing TSS prebuild flow

The implementation is well-architected, thoroughly tested, and follows BitGoJS conventions. The approach of flattening wrap parameters onto the intent (similar to defi operations) is consistent and appropriate.


CI Status: 2 workflows in progress
Branch: CHALO-1340

@BitGo BitGo deleted a comment from github-actions Bot Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

Ticket: CHALO-1340
Co-authored-by: Cursor <cursoragent@cursor.com>
@0xPrabh
0xPrabh marked this pull request as ready for review September 1, 2026 08:18

@Venkat-Annavazzala Venkat-Annavazzala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@0xPrabh
0xPrabh merged commit c4e99a4 into master Sep 1, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants